package cn.edu.sgu.www.pms.converter;

import com.alibaba.fastjson.JSON;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * String ==> List<Integer>的转换器
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Component
public class StringToListOfIntegerConverter implements Converter<String, List<Integer>> {

    @Override
    public List<Integer> convert(@NonNull String source) {
        return JSON.parseArray(source, Integer.class);
    }

}